"use strict";
cc._RF.push(module, '65686oV0/BPiLhf9l6KllM/', 'equip_ball_anime');
// scripts/equip_ball_anime.js

"use strict";

var e = require;
var t = module;
var o = exports;

var _ii,
    nn = void 0 && (void 0).__extends || (_ii = function ii(t, e) {
  return (_ii = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _ii(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    rr = void 0 && (void 0).__awaiter || function (t, e, o, i) {
  return new (o || (o = Promise))(function (n, a) {
    function r(t) {
      try {
        l(i.next(t));
      } catch (e) {
        a(e);
      }
    }

    function s(t) {
      try {
        l(i["throw"](t));
      } catch (e) {
        a(e);
      }
    }

    function l(t) {
      var e;
      t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
        t(e);
      })).then(r, s);
    }

    l((i = i.apply(t, e || [])).next());
  });
};

var oo = void 0 && (void 0).__decorate || function (e, t, a, n) {
  var i,
      o = arguments.length,
      s = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, a) : n;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);else for (var r = e.length - 1; r >= 0; r--) {
    (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
  }
  return o > 3 && s && Object.defineProperty(t, a, s), s;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var a = e("BaseModuleUI"),
    n = e("GlobalParams"),
    i = e("AssetsManager"),
    r = e("AudioManager"),
    s = e("CommonHelper"),
    l = e("Game"),
    _ = e("role_node"),
    c = cc._decorator,
    d = c.ccclass,
    h = (c.property, function (e) {
  function t() {
    return null !== e && e.apply(this, arguments) || this;
  }

  return nn(t, e), t.prototype.showEquipAnime = function (e, t) {
    var o = null;
    if (this.node.getChildByName("role_" + n.GlobalParams.MatchMyIndex)) o = this.node.getChildByName("role_" + n.GlobalParams.MatchMyIndex);else for (var a = 0; a < 3; a++) {
      if (this.node.getChildByName("role_" + a)) {
        o = this.node.getChildByName("role_" + a);
        break;
      }
    }
    var c = cc.v2(0, 0);
    o && (c = o.getPosition()), c.y += 50;

    var d = function d(e, t, o, a) {
      var n = (1 - a) * (1 - a),
          i = 2 * a * (1 - a),
          r = a * a,
          s = cc.v2(e.x + (t.x - e.x) / 2, e.x + o);
      return e.mul(n).add(s.mul(i)).add(t.mul(r));
    },
        h = function h(e) {
      var a = cc.instantiate(i["default"].getInstance().getFightPrefab("equip_ball"));
      a.setPosition(t), a.active = !0;
      var n = s["default"].getRandom(0.5, 0.8),
          h = cc.v2(s["default"].getRandomInt(250, 150) * (0 == s["default"].getRandomInt(0, 1) ? 1 : -1), s["default"].getRandomInt(-60, 50)),
          p = s["default"].getRandomInt(200, 300);
      0 == e && r["default"].getInstance().playFx("ball_out"), cc.tween(a).by(n, {
        position: h
      }, {
        progress: function progress(e, t, o, a) {
          return d(e, t, p, a);
        }
      }).delay(0.8).to(0.5, {
        position: cc.v2(c.x, c.y)
      }).call(function () {
        o && o.getComponent(_["default"]).addRoleEffects(l.RoleEffectType.get_equip), r["default"].getInstance().playFx("get_ball"), a.destroy();
      }).start(), u.node.addChild(a);
    },
        u = this;

    for (a = 0; a < e; a++) {
      h(a);
    }
  }, oo([d], t);
}(a["default"]));

o["default"] = h;

cc._RF.pop();